<%@codepage="65001"%> 
<!--#include file="conn.asp" -->
<!--#include file="config.asp" -->
<%
Response.Addheader "Content-Type","text/html; charset=utf-8"
'文章点击数
if request("click")="content" then
curid=request("ID")
set rs = server.createobject("adodb.recordset")
sql = "select * from content where Cid= " + cstr(curid) 
rs.open sql,conn,1,1 
sql = "update content SET visits=visits+1 where Cid="&curid 
conn.execute sql 
Response.Write("document.writeln("""&rs("visits")&""");")
rs.close
set rs=nothing
end if


if request("user")="check" then'注册检查用户名
username=trim(request.QueryString("username"))
  if username<>"" then 
	  if len(username)<5 or InStr(username,"非会员")>0 or InStr(username,"'")>0 or InStr(username,"admin")>0 or InStr(username,"(")>0 or InStr(username,";")>0 or InStr(username,"#")>0 then
		  response.write"<i style='font-size:9pt;color:#ff0000;'>此用户名不可用,请重新输入</i>"
		  response.end
	  end if
	  
	  set rs3=server.CreateObject("adodb.recordset")
	  sql3="select * from [user] where username='"&username&"'"
	  rs3.open sql3,conn,1,1
	  if rs3.bof or rs3.eof then
		 response.write"<i style='font-size:9pt;color:#093;'>此用户名可以用</i>"
	  else
		 response.write"<i style='font-size:9pt;color:#ff0000;'>此用户名已被使用,重新输入</i>"
	  end if
	  rs3.close
	  set rs3=nothing
	end if  	
end if

if request("user")="Code" then'验证码
VerifyCode=trim(request.QueryString("VerifyCode"))
if cstr(Session("firstecode"))<>cstr(VerifyCode) then
	Response.Write("<i style='font-size:9pt;color:#ff0000;'>验证码错误</i>")
else
	Response.Write("<i style='font-size:9pt;color:#093;'>验证码正确</i>")
end if
end if

if request("user")="check_t" then'注册检查用户名
tel=trim(request.QueryString("tel"))
  if tel="" then 
  response.write"<div style='padding-top:5px;font-size:9pt;line-height:26px;color:#ff0000;font-weight:bold;'>手机号不能为空</div>"
  response.end
  end if
  if len(tel)<>11 or not isnumeric(tel) then
	  response.write"<span style='font-size:9pt;color:#ff0000;'>手机号不正确</span>"
	  response.end
  end if
  
  set rs3=server.CreateObject("adodb.recordset")
  sql3="select * from [user] where tel='"&tel&"'"
  rs3.open sql3,conn,1,1
  if rs3.bof or rs3.eof then
	 response.write"<i style='font-size:9pt;color:#093;'>此手机号可以用</i>"
  else
	 response.write"此手机号已被使用,重新输入"
  end if
  rs3.close
  set rs3=nothing
end if



if request("action")="bookadd" then
set rs=server.createobject("adodb.recordset")
sql="select * from Message"
rs.open sql,conn,1,3
name=request.form("name")
body=request.form("body")
qq=request.form("qq")
sh=request.form("sh")
add=request.form("add")
VerifyCode=request.form("VerifyCode") 
IF sh="" or not isNumeric(request("sh")) then
response.write("<script>alert(""警告！请勿尝试外部提交数据！""); history.go(-1);</script>")
response.end
end if
if cstr(Session("firstecode"))<>cstr(Request.Form("VerifyCode")) then
response.Write("<script language=javascript>alert('验证码错误!');history.go(-1)</script>")
response.End
end if
rs.addnew
rs("body")=body
rs("name")=name
rs("ip")=Request.ServerVariables("REMOTE_ADDR")
rs("add")=add
rs("qq")=qq
rs("sh")=sh
rs.update
rs.close
set rs=nothing
conn.close
set rs=nothing
Response.Write "<script>alert('留言提交成功！');window.location.href='"&dir&"Contact/';</script>" 
end if

'''加入购物车
if request("action")="spc" then
  productlist=Request.Cookies("productlist")
  cid =request("cid")
  
  if Request.Cookies("productlist")="" then
     Response.Cookies("productlist") =cid
     Response.Write "添加购物车成功" 
  else
	 if Request.Cookies("productlist")<>"" and instr(productlist,cid)>0 then
		  Response.Write "已经加入购物车"
	 else
		  Response.Cookies("productlist") = Request.Cookies("productlist")&","&cid'把id全部存储到allid中类似与数组
		  Response.Write "添加购物车成功"  
	 end if
  end if
End if
'''清空购物车
if request("action")="spcdel" then
	If Request.Cookies("productlist")<>"" Then
		Response.Cookies("productlist")=""
		Response.Write ("清空购物车成功")
	Else
		Response.Write ("购物车中没有商品")
	End If
End if
conn.close
set conn=nothing
%>
